import { takeEvery, put }  from 'redux-saga/effects'
import { get_products, get_products_success } from '../actions/product'
import axios from 'axios'

function* handleProducts() {
  // console.log('33')
  // const res = yield axios.get('http://localhost:3005/goods')
  // console.log(res)
  const { data } = yield axios.get('http://localhost:3005/goods')
  yield put(get_products_success(data))
}

export default function* productSaga () {
  yield takeEvery(get_products, handleProducts)
}